<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">

    <title>娄底市信息技术学考平台1.0</title>
    <meta name="keywords" content="Nutz,fcre,AI无纸化">
    <meta name="description" content="FCRE是基于nutzboot的教学练考综合平台。 核心技术采用nutz、nutzboot、Shiro没有任何其它重度依赖">
    <link href="../static/assets/css/bootstrap.min.css" th:href="@{/assets/css/bootstrap.min.css}" rel="stylesheet"/>
    <link href="../static/assets/css/font-awesome.min.css" th:href="@{/assets/css/font-awesome.min.css}" rel="stylesheet"/>
    <link href="../static/assets/css/style.css" th:href="@{/assets/css/style.css}" rel="stylesheet"/>
    <link href="../static/assets/css/login.min.css" th:href="@{/assets/css/login.min.css}" rel="stylesheet"/>
    <link href="../static/assets/css/ui.css" th:href="@{/assets/css/ui.css}" rel="stylesheet"/>

    <link rel="shortcut icon" href="../static/assets/img/fcre.png" th:href="@{/assets/img/fcre.png}"/>
    <script>var base="./",bver="",localip="00:00:00:00";;</script>
    <script th:inline="javascript">
    var ctx = [[${AppBase}]];
    </script>
    <style type="text/css">    
    label.error {
        position: inherit;
    }
	#loginlogo{
    	width: 436px;
    height: 196px;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    overflow: hidden;
    background-image: url(/assets/img/login_01.jpg);
    background-size: 100% 100%;
    -moz-background-size: 100% 100%;
    }
    #loginlogo p{
    	margin-top: 170px;
    padding-left: 20px;
    background-color: rgba(255, 87, 34, 0.5803921568627451);
    font-size: 20px;
    font-weight: bold;
    }
    </style>

</head>

<body class="signin">


<div class="signinpanel">
    <div class="row">

        <div class="" style="width:436px;">
        <div id="loginlogo">
			<p>考试中心</p>
		</div>
            <form id="signupForm">
            <table id="logint" style="width:404px;border-bottom: 0px solid #e7eaec;"><tr><td style="width:250px;">
		       <!-- <input type="hidden" name="pubkey" class="form-control uname" placeholder="pubKey" th:value="${pubkey}"/> -->
                <input type="text" name="username" class="form-control uname" placeholder="用户名" value=""/>
                <input type="password" name="password" class="form-control pword" placeholder="密码" value=""/>
				<input type="hidden" id="rememberme" name="rememberme" value="0">
                <div class="row m-t" th:if="${captchaEnabled==true}">
                    <div class="col-xs-6">
                        <input type="text" name="validateCode" class="form-control code" placeholder="验证码"
                               maxlength="5">
                    </div>
                    <div class="col-xs-6">
                        <a href="javascript:void(0);" title="点击更换验证码">
                            <img th:src="@{captcha/next}" class="imgcode" width="85%" height="34px"/>
                        </a>
                    </div>
                </div>
		       </td><td style="vertical-align: top;">
		       <div id="pbtn">
				  <div id="btnlabel">登录</div>
				</div>
				</td></tr>
				<tr>
				<td colspan="2">
					&copy; 2020 All Rights Reserved.
				</td>
				</tr>
		</table>
		<div id="updn" >
		<a id="dn" class="btn btn-danger" style="margin-right: 75px;font-weight: bold;font-size: 18px;">	<i class="fa fa-download"></i> 下载考前数据</a>
		<a id="up" class="btn btn-warning" style="font-weight: bold;font-size: 18px;">	<i class="fa fa-upload"></i> 上传考后数据</a>
		</div>
        <div id="bver" style="color: #f00;background-color: #FFEB3B;text-align: center;line-height: 30px;margin-top: 10px;"> 
		
</div>        
            </form>
        </div>
    </div>

</div>
<th:block th:include="loading :: loading" /> 
 <img id="gear-1" class="gear-display gear-large-anim" th:src="@{/assets/img/o_da.png}">	
<img class="gear-display gear-large-anim" id="gear-2" th:src="@{/assets/img/o_da1.png}">
<img class="gear-display" id="gear-3" th:src="@{/assets/img/o_da3.png}">
<!-- 全局js -->
<script src="../static/assets/js/jquery.min.js" th:src="@{/assets/js/jquery.min.js}"></script>
<script src="../static/assets/js/bootstrap.min.js" th:src="@{/assets/js/bootstrap.min.js}"></script>
<!-- 验证插件 -->
<script src="../static/assets/plugins/validate/jquery.validate.min.js"
        th:src="@{/assets/plugins/validate/jquery.validate.min.js}"></script>
<script src="../static/assets/plugins/validate/messages_zh.min.js"
        th:src="@{/assets/plugins/validate/messages_zh.min.js}"></script>
<script src="../static/assets/plugins/layer/layer.min.js" th:src="@{/assets/plugins/layer/layer.min.js}"></script>
<script src="../static/assets/plugins/blockUI/jquery.blockUI.js"
        th:src="@{/assets/plugins/blockUI/jquery.blockUI.js}"></script>
<script src="../static/assets/js/ui.js" th:src="@{/assets/js/ui.js}"></script>
    <script>
    var p="";
        if (window.top !== window.self) {
            window.top.location = window.location
        };
        $(function() {
        	$("#updn").hide();
        	//$("#bver").hide();
        	$("#loading").hide();
            validateRule();
            $('.imgcode').click(function() {
                var url = "captcha/next?w=120&h=60&s=" + Math.random();
                $(".imgcode").attr("src", url);
            });
        	$("#pbtn").click(function() {$("#signupForm").submit();});
        	$("#signupForm").keydown(function(event){
        		　　if(event.keyCode==13)$("#signupForm").submit();
        	});
			$("#dn").click(function(){
			//$.modal.confirm("本地数据将会被清空！！！你确定要下载中心的数据吗？",function(){
				$("#loading").show();
				//$("#bver").html("正在下载考试数据，请耐心等待...");
				DnExam();//{p:p}
			//});
                
			});
			$("#up").click(function(){
				$("#loading").show();
				//$("#bver").html("正在上传考试数据，请耐心等待...");
				UpExam();//{p:p}
               
			})
        });

        $.validator.setDefaults({
            submitHandler: function() {
        		login();
            }
        });

        function login() {
        	//$.modal.loading($("#btnSubmit").data("loading"));
        	var username = $.common.trim($("input[name='username']").val());
            var password = $.common.trim($("input[name='password']").val());
            var validateCode = $("input[name='validateCode']").val();
            var rememberMe = $("input[name='rememberme']").is(':checked');

            $.ajax({
                type: "post",
                url: "/login/kdlogin",
                data: {
                    "username": username,
                    "password": password,
                    "validateCode" : validateCode,
                    "rememberMe": rememberMe,
                    "update": true
                },
                success: function(r) {
                    if (r.code == 0) {
                    	p=r.msg;
                    	$("#updn").show();
                    	//$("#bver").show();
                    	$("#logint").hide();
						IsLogin(p+"|"+username+"|"+password);
                    } else {
                    	$.modal.closeLoading();
                    	$('.imgcode').click();
                    	$(".code").val("");
                    	$.modal.msg(r.msg);
                    }
                }
            });
        }

        function validateRule() {
            var icon = "<i class='fa fa-times-circle'></i> ";
            $("#signupForm").validate({
                rules: {
                    username: {
                        required: true
                    },
                    password: {
                        required: true
                    }
                },
                messages: {
                    username: {
                        required: icon + "请输入您的用户名",
                    },
                    password: {
                        required: icon + "请输入您的密码",
                    }
                }
            })
        }
function cancelUD(){
	$("#loading").hide();
	//$("#bver").html("数据传输被取消");
}
function enddn(o){
	$("#loading").hide();
	if(o=="0"){
    	//$("#bver").html("考试数据下载完成，请启动本地系统，准备考试...");
    	window.location.href="/login/kdlogout";
		$("#updn").hide();
	}
	//else $("#bver").html("下载数据时，出现："+o+"\r\n，请联系上级管理员。");
}
        
    </script>
</body>
</html>
